%{
	#include "y.tab.h"
	#include <stdio.h>
	#include <stdlib.h>
	#include <string.h>
	#include "../tableSymbole/hashTable.h"
	#include "tableGencode.h"
	#include "tableValueText.h"
	
	char * charTemp;
	extern int yylval;
	extern int erreurCompilation;
%}

chiffre [0-9]
lettreMin [a-z]
lettreMaj [A-Z]
lettre {lettreMin}|{lettreMaj}
caractere {lettre}|{chiffre}
entier {chiffre}+
blanc " "|"\t"|"\r"|"\n"
identifiant {lettre}{caractere}*

%%

"write" {return WRITE;}
"var" {return VAR;}
"int" {return INT;}
"bool" {return BOOLEEN;}
"string" {return STRING;}
"not" {return NOT;}
"or" {return OR;}
"and" {return AND;}
"xor" {return XOR;}
"true" {yylval = 1; return BOOL;}
"false" {yylval = 2; return BOOL;}
"+" {return PLUS;}
"*" {return FOIS;}
"-" {return MOINS;}
"(" {return PGAUCHE;}
")" {return PDROITE;}
":=" {return AFFECTATION;}
";" {return POINTVIRGULE;}
":" {return DEUXPOINTS;}
"<" {return PPETITS;}
">" {return PGRANDS;}
"<=" {return PPETIT;}
">=" {return PGRAND;}
"=" {return EGAL;}
"<>" {return DIFFERENT;}
{entier} {yylval = atoi(yytext); return ENTIER;}
{identifiant} {charTemp = calloc(strlen(yytext)+1,sizeof(char));strcpy(charTemp,yytext);yylval = ajoutTableValueText(charTemp); if(yylval == -1) {printf("Erreur : lex : table valeur text pleine.\n"); erreurCompilation = 1;} return IDENTIFIANT;}
{blanc}
